To Use a GUID Field for an Existing Table
-
Add the ID field of type vachar2.
ALTER TABLE Buildings add (PK VARCHAR2(64));
-
Set the ID field to a GUID following XFM syntax.
update Buildings set PK = LOWER (substr(sys_guid(), 1, 8)||'-'||substr(sys_guid(),9,4)||'-'||substr(sys_guid(),13,4)||'-'||substr(sys_guid(),17,4)||'-'||substr(sys_guid(),21,12));
-
Set the primary key for the table.
ALTER TABLE Buildings ADD CONSTRAINT Buildings_PK PRIMARY KEY (PK);